<template>
  <div>
    <elBread></elBread>
    <el-button @click="addDialog" class="butinfo" size="small" type="primary" plain>添加</el-button>
    <List @edit='edit'></List>
    <Dialog ref="diaform" @cancel='cancel' :add='add'></Dialog>
  </div>
</template>
<script>
import Dialog from "./dialog.vue";
import List from "./list.vue";

export default {
  data() {
    return {
      add: {
        isShow: false,
        isAdd: true,
      },
    };
  },

  components: {
    List,
    Dialog,
  },

  methods: {
    // 点击编辑
    addDialog() {
      this.add.isShow = true,
        this.add.isAdd = true
    },

    // 传回来的数据 
    cancel(e) {
      this.add.isShow = e
    },


    //  在列表页，打开 对话框
    edit(e) {
      this.add.isShow = true
      this.add.isAdd = false
      // 告诉
      this.$refs.diaform.lookup(e)
    }



  },
};
</script>
<style lang="less" scoped>
.butinfo {
  margin: 10px 7px;
}
</style>